# coding=utf-8
import logging
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from logging.config import fileConfig

from config import settings
from log.logUtils import logger

fileConfig(settings.Logging_FILE)
# 创建一个日志器logger

logger = logging.getLogger('simpleExample')
class M:

    def 测试1(self):
        pass


    def test_f1(self):
        my_sender = 'no-reply@53zaixian.com'
        my_user = 'yongweiy@53zaixian.com'
        # msg = MIMEText('vrdjo', 'plain', 'utf-8')

        msg = MIMEText('2223344', 'plain', 'utf-8')
        msg['From'] = formataddr(('若水', my_sender))  # 括号里的对应发件人邮箱昵称、发件人邮箱账号
        msg['To'] = formataddr(('小伙伴', my_user))  # 括号里的对应收件人邮箱昵称、收件人邮箱账号
        msg['Subject'] = "ceshi2"  # 邮件的主题，也可以说是标题

        server = smtplib.SMTP('smtp.feishu.cn', 587)
        server.starttls()
        server.ehlo()
        server.login(my_sender, 'S5BzC3dqBIQkY06J')
        server.sendmail(msg['From'], msg['To'], msg.as_string())
        server.close()


if __name__ == '__main__':
    m =  M()
    m.test_f1()
    pass
    # M().测试1()
    # logger.error('1111111111111111e1 rror message')
    # logger.critical('2222222222222222222222critical message')
    # # logger.info(" 11111")
    # # logger.error('2222 error message')
    # # logger.critical('3333 critical message')
    # # logger.info("logging：" + str(123) )
    # logger.info("a=========== : \n %s  ", "data")
    # logger.info('初始化数据开始.........test_setup_class.........初始化数据开始\n')
    # logger.critical("请求参数params: {0}".format(11111))
    # logger.error("******* 正在执行模块【{0}】用例 ->{1} *********".format(11, 222))
    # # logging.disable(logging.DEBUG)
    #
